﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AuthMenu.aspx.cs" Inherits="CardLogistics.Web.MainPage.SystemMgr.SysRole.AuthMenu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function CheckEvent(evt) {
            evt = window.event || evt;
            var objNode = evt.srcElement || evt.target;
            if (objNode.tagName == "INPUT" && objNode.type == "checkbox") {
                var objParentDiv = objNode.id.replace("CheckBox", "Nodes");
                if (objNode.checked == true) {
                    setChildCheckState(objParentDiv, true);

                    setParentCheckeState(objNode, true);
                }
                else {
                    setChildCheckState(objParentDiv, false);
                    if (!HasOtherChecked(objNode)) {
                        setParentCheckeState(objNode, false);
                    }
                }
            }
        }

        //判断是否有并行的其他节点被选中
        function HasOtherChecked(objNode) {
            var objParentDiv = WebForm_GetParentByTagName(objNode, "div");

            var chks = objParentDiv.getElementsByTagName("INPUT");
            for (var i = 0; i < chks.length; i++) {
                if (chks[i].checked && chks[i].id != objNode.id) {
                    return true;
                }
            }
            return false;
        }

        //设置父节点
        function setParentCheckeState(objNode, chkstate) {
            try {
                var objParentDiv = WebForm_GetParentByTagName(objNode, "div");

                if (objParentDiv == null || objParentDiv == "undefined ") {
                    return;
                }
                else {
                    var objParentChkId = objParentDiv.id.replace("Nodes", "CheckBox");
                    var objParentCheckBox = document.getElementById(objParentChkId);

                    if (objParentCheckBox) {
                        objParentCheckBox.checked = chkstate;
                        setParentCheckeState(objParentDiv, chkstate);
                    }
                }
            }
            catch (e) { }
        }

        //设置子节点
        function setChildCheckState(nodeid, chkstate) {
            var node = document.getElementById(nodeid);

            if (node) {
                var chks = node.getElementsByTagName("INPUT");
                for (var i = 0; i < chks.length; i++) {
                    chks[i].checked = chkstate;
                }
            }
        }
    </script>
    <style type="text/css">
        .treeCss
        {
            line-height: 26px;
            margin-left: 20px;
        }
        .tiptop
        {
            height: 30px;
            line-height: 30px;
            background: url(../../../images/tcbg.gif) repeat-x;
            cursor: pointer;
        }
        .tiptop span
        {
            font-size: 14px;
            font-weight: bold;
            color: #fff;
            float: left;
            text-indent: 20px;
        }
        .tiptop a
        {
            display: block;
            background: url(../../../images/close.png) no-repeat;
            width: 22px;
            height: 22px;
            float: right;
            margin-right: 7px;
            margin-top: 5px;
            cursor: pointer;
        }
        .tiptop a:hover
        {
            background: url(../../../images/close1.png) no-repeat;
        }
        .tipbtn
        {
            text-align:center;
            margin-top:20px;
        }
        .sure, .cancel
        {
            width: 96px;
            height: 35px;
            line-height: 35px;
            color: #fff;
            background: url(../../../images/btnbg1.png) repeat-x;
            font-size: 14px;
            font-weight: bold;
            border-radius: 3px;
            cursor: pointer;
        }
        .cancel
        {
            background: url(../../../images/btnbg2.png) repeat-x;
            color: #000;
            font-weight: normal;
            margin-left:15px;
        }
    </style>
</head>
<body style="background-color: #FCFDFD; margin-left: 0px; margin-top: 0px; margin-right: 0px;">
    <form id="form1" runat="server">
    <div class="tiptop">
        <span>
            <%=RoleName %></span><a onclick="window.close();"></a></div>
    <div style="font-size:14px; height:400px; overflow-y:auto;overflow-x:auto;">
        <asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" CssClass="treeCss"
            ShowLines="True" ForeColor="Black">
        </asp:TreeView>
    </div>
    <div class="tipbtn">
        <asp:Button ID="btn_Sure" CssClass="sure" runat="server" Text="确定" 
            onclick="btn_Sure_Click" />
        <input name="btn_Cancel" id="btn_Cancel" type="button" class="cancel" onclick="window.close();" value="取消" />
    </div>
    </form>
</body>
</html>
